home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Mania 5
/
MacMania 5.toast
/
/
Tools&Utilities
/
Plotfoil 3.2
/
nacafix.pl
< prev
next >
Wrap
Perl Script
|
1995-09-18
|
946b
|
49 lines
#!/usr/local/bin/perl
# convert data in old NACA format
# Clark YH
# 0 0 0
# 0.0125 0.0409 -0.0183
# 0.025 .0529 -.0271
# ...
# 1.0 0 0
# to the new (Soartech 8) format.
# SD-8020
# 1.0 0
# 0.9 0.011
# 0.85 0.02
# ...
# 1.0 0
#
$tmpfile = "tmp-nacafix-$$";
foreach $filename (@ARGV) {
next if(! -f $filename);
open(INFILE, $filename);
open(OUTFILE, ">$tmpfile");
print OUTFILE scalar <INFILE>;
$i = 0;
while(<INFILE>) {
($x, $lower, $upper) = split(' ');
$upper{$i} = $x . " " . $upper . "\n";
$lower{$i} = $x . " " . $lower . "\n";
$i++;
}
$n = $i;
$_ = "";
for(; $i >= 0; $i--) {
print OUTFILE $upper{$i};
}
$i = 0;
$i++ if($upper{$i} eq $lower{$i});
for(; $i < $n; $i++) {
print OUTFILE $lower{$i};
}
close(INFILE); close(OUTFILE);
rename($filename, $filename . ".bak");
rename($tmpfile, $filename);
}